<template>
  <div class="recordCss">
    <div class="titleCss">疫苗管理</div>
    <div class="bodyCss">
      <div class="tableCss">
        <el-form :model="formData" ref="queryForm" size="small" label-width="120px">
          <el-form-item label="人员名称" label-width="120px">
            <el-input v-model="formData.data1" placeholder="请输入"></el-input>
          </el-form-item>
          <div class="formBtnCss">
            <el-button type="primary" @click="searchBtn">查询</el-button>
            <el-button @click="resetBtn">重置</el-button>
          </div>
        </el-form>
        <el-table
          max-height="480"
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            width="55"
            align="center">
          </el-table-column>
          <el-table-column
            prop="data1"
            label="疫苗名称"
            min-width="100">
          </el-table-column>
          <el-table-column label="操作" align="center" fixed="right" width="300">
            <template slot-scope="scope">
              <el-button size="mini" type="text" @click="recordBtn(scope.row,0)">疫苗运输记录</el-button>
              <el-button size="mini" type="text" @click="recordBtn(scope.row,1)">疫苗储存温度记录</el-button>
              <el-button size="mini" type="text" @click="recordBtn(scope.row,2)">疫苗出库记录</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          style="margin-top:10px;text-align: right;"
          :pageSize="pageSize"
          layout="prev, pager, next"
          :page-sizes="[10, 20, 50]"
          :total="total"
          @sizeChange="handleSizeChange"
          @currentChange="handleCurrentChange">
        </el-pagination>
      </div>
    </div>
    <div class="bottomBtnCss">
      <el-button @click="goBackBtn">返回</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      formData:{
        data1:null,
      },
      tableData:[],
      pageSize:10,
      total:1000,
    }
  },
  mounted(){
    this.getList()
  },
  methods:{
    recordBtn(row, type){
      const obj = {
        path: '/healthCare/test7/vaccineManagement/record',
        query: {
          id: '111',
          type: type,
        }
      }
      this.$router.push(obj);
    },
    handleCurrentChange(){
      
    },
    handleSizeChange(){
      
    },
    resetBtn(){

    },
    searchBtn(){
      
    },
    goBackBtn(){
      this.$router.back()
    },
    getList(){
      const random = Math.floor( Math.random() * 10) + 5
      let list = []
      for( let i=0;i<random;i++){
        const random1 = Math.floor( Math.random() * 2) 
        list.push({
          data1: '【测试数据】疫苗名称xxxxxxxxxxxxxxx',
        })
      }
      this.tableData = list
    },
  },
}
</script>

<style lang="scss" scoped>
.recordCss{
  overflow: hidden;
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  height: calc( 100vh - 66px - 40px);
  display: flex;
  flex-direction: column;
  .titleCss{
    text-align: center;
    font-size: 24px;
    font-weight: bold;
  }
  .bodyCss{
    margin-top: 20px;
    margin-left: 20px;
    width: calc( 100% - 10px);
    padding-right: 40px;
    overflow-y: auto;
    height: calc( 100% - 90px);
    padding-bottom: 20px;
    .tableCss{
      padding-bottom: 20px;
      margin-top: 20px;
      .el-form{
        display: flex;
        flex-wrap: wrap;
        .formBtnCss{
          margin-left: 20px;
          text-align: center;
        }
      }
    }
  }
  .bottomBtnCss{
    margin-top: auto;
    text-align: right;
  }
}
</style>